package com.yoyosys.jdbcdatdbase.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;

/**
 * @ClassName JdbcTemplateConfig
 * @Description JdbcTemplate 配置
 * @Author zjw
 * @Date 2020/5/27 17:05
 * @Version 1.0
 **/

@Configuration
public class JdbcTemplateConfig {

    @Bean(name = "primaryJdbcTemplate")
    public JdbcTemplate primaryJdbcTemplate(DataSource primaryDataSource) {
        return new JdbcTemplate(primaryDataSource);
    }

    @Bean(name = "secondaryJdbcTemplate")
    public JdbcTemplate secondaryJdbcTemplate(DataSource secondaryDataSource) {
        return new JdbcTemplate(secondaryDataSource);
    }
    @Bean(name = "oracleJdbcTemplate")
    public JdbcTemplate oracleJdbcTemplate(DataSource oracleDataSource) {
        return new JdbcTemplate(oracleDataSource);
    }

    @Bean(name = "dmJdbcTemplate")
    public JdbcTemplate dmJdbcTemplate(DataSource dmDataSource) {
        return new JdbcTemplate(dmDataSource);
    }

    @Bean(name = "h2JdbcTemplate")
    public JdbcTemplate h2JdbcTemplate(DataSource h2DataSource) {
        return new JdbcTemplate(h2DataSource);
    }

    @Bean(name = "sqlServiceJdbcTemplate")
    public JdbcTemplate sqlServiceJdbcTemplate(DataSource sqlServiceDataSource) {
        return new JdbcTemplate(sqlServiceDataSource);
    }
}
